<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>验证码</title>
<% include("/common/inc/_css.html"){} %>
</head>
<body>
	<br />
	<h3>邮箱验证：</h3>
	<input type="text" name="email" /> 
	
	
	<button type="button" class="am-btn am-btn-primary btn-loading-example sendMsg">发送邮箱验证码</button>
	
	<br />


	<% include("/common/inc/_js.html"){} %>
	<script type="text/javascript">
		$(function(){
			
			$('.btn-loading-example').click(function () {
			  var $btn = $(this)
			  $btn.button('loading');
			    setTimeout(function(){
			      $btn.button('reset');
			  }, 60000);
			});
			
			// http://www.jb51.net/article/35535.htm
			$(".sendMsg").click(function(){
				var clickable = $(this).attr("clickable");
				console.log("clickable:"+clickable);
				if(clickable=="0"){	
					alert("不能点了");			
					return;
				}
				//启动倒计时
				msgTimeOut();
				
				//设置不能点击了
				$(this).attr("clickable","0");
				
			})		
		})
		var msgTime = 60;
		function msgTimeOut(){
			if(msgTime ==0){
				console.log("执行中");
				$(".sendMsg").attr("clickable","1");
				$(".sendMsg").html("发送短信验证码");
				msgTime = 10;
				return;
			}
			msgTime--;
			$(".sendMsg").html(msgTime);
			setTimeout("msgTimeOut()",1000);
		}
	</script>
</body>
</html>